package br.com.searchpeople.activity;

import br.com.searchpeople.R;
import br.com.searchpeople.fragment.SettingsFragment;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;

public class SettingsActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		// Display the fragment as the main content.
		getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
	}

	// @SuppressWarnings("deprecation")
	// @Override
	// protected void onCreate(Bundle savedInstanceState) {
	// super.onCreate(savedInstanceState);
	// //getFragmentManager().beginTransaction().replace(android.R.id.content,
	// new MyPreferenceFragment()).commit();
	// addPreferencesFromResource(R.xml.settings);
	// Preference myPref = findPreference("logout");
	// myPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
	// @Override
	// public boolean onPreferenceClick(Preference preference) {
	// logoutMethod();
	// return false;
	// }
	// });
	//
	//
	// }
	// @SuppressWarnings("deprecation")
	// public void logoutMethod() {
	// AlertDialog alertDialog = new AlertDialog.Builder(this).create();
	// alertDialog.setTitle("Logout");
	// alertDialog.setMessage("Deseja realmente sair?");
	// alertDialog.setButton2("Sair", new DialogInterface.OnClickListener() {
	// @Override
	// public void onClick(final DialogInterface dialog, final int which) {
	// SharedPreferences settings =
	// getSharedPreferences("general",Context.MODE_PRIVATE);
	// SharedPreferences.Editor editor = settings.edit();
	// try {
	// editor.clear();
	// } catch (Exception e) {
	// Log.e("Erron in clear sharedopreferences", e.toString());
	// } finally {
	// editor.commit();
	// }
	// Intent i = new Intent(getApplicationContext(), LoginActivity.class);
	// startActivity(i);
	// finish();
	//
	// }
	// });
	// alertDialog.setButton3("Cancelar", new DialogInterface.OnClickListener()
	// {
	// @Override
	// public void onClick(final DialogInterface dialog, final int which) {
	//
	// }
	// });
	// alertDialog.setIcon(R.drawable.logout_icon);
	// alertDialog.show();
	// }
}